package com.example.pdftoofd.controller;

import com.example.pdftoofd.entity.HistoryEntity;
import com.example.pdftoofd.result.BaseResult;
import com.example.pdftoofd.service.HistoryService;
import com.example.pdftoofd.utils.MyFileUtil;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "记录管理")
@RestController
@RequestMapping("/history")
public class HistoryController {
    @Autowired
    private HistoryService historyService;

    @GetMapping("/intraDay")
    public BaseResult getIntraDayHistory() {
        List<HistoryEntity> historyEntities = historyService.readHistory();
        return BaseResult.success(null, historyEntities);
    }

    @GetMapping("/date")
    public BaseResult getHistory(@RequestParam String date) {
        List<HistoryEntity> historyEntities = historyService.readHistory(date);
        return BaseResult.success(null, historyEntities);
    }
}
